﻿<%@ Page Title="" Language="C#" MasterPageFile="~/DeveloperSite.Master" AutoEventWireup="true" 
    CodeBehind="Output_Indicators.aspx.cs" Inherits="Amkeni_System.CO.Output_Indicators" 
    MaintainScrollPositionOnPostback="true" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <asp:EntityDataSource ID="EntityDataSource1" runat="server" 
        ConnectionString="name=Amkeni_DatabaseEntities" DefaultContainerName="Amkeni_DatabaseEntities" 
        EnableFlattening="False" EntitySetName="indicators" Where="it.indicator_type_id = 1"
        EnableDelete="True" EnableInsert="True" EnableUpdate="True">
    </asp:EntityDataSource>

    <div style="height:2em;">
        <div style="float:left;">
            <asp:Label ID="ContextLabel" runat="server" Text="PROGRAMME OUTPUT INDICATORS" CssClass="ContentHead"></asp:Label>
        </div>
        <% if (User.IsInRole("Administrator"))
           { %>
            <div style="float:right;">
                <asp:Button ID="AddOutputIndicatorButton" runat="server" Text="Add New Programme Output Indicator" 
                    OnClick="AddOutputIndicatorButton_Click" />
            </div>
        <% } %>
    </div>

    <% if (User.IsInRole("Administrator"))
       { %>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataSourceID="EntityDataSource1" CssClass="NewGrid" ShowFooter="True" 
            AllowSorting="True" OnRowDataBound="GridView1_RowDataBound"
        DataKeyNames="indicator_id">
            <AlternatingRowStyle CssClass="NewGridAlt" />
            <Columns>
                <asp:BoundField DataField="output_indicator_id" 
                    HeaderText="Output Indicator ID" SortExpression="output_indicator_id" ReadOnly="True">
                </asp:BoundField>
                <asp:TemplateField HeaderText="Indicator" SortExpression="name">
                    <EditItemTemplate>
                        <asp:TextBox runat="server" Text='<%# Bind("name") %>' ID="TextBox1" TextMode="MultiLine"
                            Height="70px" Width="200px" CssClass="MText"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label runat="server" Text='<%# Bind("name") %>' ID="Label1"></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Baseline" SortExpression="baseline">
                    <EditItemTemplate>
                        <asp:TextBox runat="server" Text='<%# Bind("baseline") %>' ID="TextBox2" TextMode="MultiLine"
                            Height="70px" Width="200px" CssClass="MText"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label runat="server" Text='<%# Bind("baseline") %>' ID="Label2"></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Target" SortExpression="target">
                    <EditItemTemplate>
                        <asp:TextBox runat="server" Text='<%# Bind("target") %>' ID="TextBox3" TextMode="MultiLine"
                            Height="70px" Width="200px" CssClass="MText"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label runat="server" Text='<%# Bind("target") %>' ID="Label3"></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Data Source" SortExpression="data_source">
                    <EditItemTemplate>
                        <asp:TextBox runat="server" Text='<%# Bind("data_source") %>' ID="TextBox4" TextMode="MultiLine"
                            Height="70px" Width="200px" CssClass="MText"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label runat="server" Text='<%# Bind("data_source") %>' ID="Label4"></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Method of Collection" SortExpression="method_of_collection">
                    <EditItemTemplate>
                        <asp:TextBox runat="server" Text='<%# Bind("method_of_collection") %>' ID="TextBox5" TextMode="MultiLine"
                            Height="70px" Width="200px" CssClass="MText"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label runat="server" Text='<%# Bind("method_of_collection") %>' ID="Label5"></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Collection Tools" SortExpression="collection_tools">
                    <EditItemTemplate>
                        <asp:TextBox runat="server" Text='<%# Bind("collection_tools") %>' ID="TextBox6" TextMode="MultiLine"
                            Height="70px" Width="200px" CssClass="MText"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label runat="server" Text='<%# Bind("collection_tools") %>' ID="Label6"></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Assumptions and Risks" SortExpression="assumptions_and_risks">
                    <EditItemTemplate>
                        <asp:TextBox runat="server" Text='<%# Bind("assumptions_and_risks") %>' ID="TextBox7" TextMode="MultiLine"
                            Height="70px" Width="200px" CssClass="MText"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label runat="server" Text='<%# Bind("assumptions_and_risks") %>' ID="Label7"></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Means of Verification" SortExpression="means_of_verification">
                    <EditItemTemplate>
                        <asp:TextBox runat="server" Text='<%# Bind("means_of_verification") %>' ID="TextBox8" TextMode="MultiLine"
                            Height="70px" Width="200px" CssClass="MText"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label runat="server" Text='<%# Bind("means_of_verification") %>' ID="Label8"></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:CommandField ShowEditButton="true" ButtonType="Button" HeaderText="EDIT" />
                <asp:TemplateField HeaderText="DELETE" ShowHeader="False">
                    <ItemTemplate>
                        <asp:Button runat="server" Text="Delete" CommandArgument='<%# Eval("indicator_id") %>' 
                            CommandName="Delete" CausesValidation="false" ID="DeleteButton" 
                            OnClick="DeleteButton_Click"></asp:Button>
                    </ItemTemplate>
                </asp:TemplateField>

            </Columns>
            <FooterStyle CssClass="NewGridFooter" />
        </asp:GridView>
    <% }
       else
       { %>
       <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" 
        DataSourceID="EntityDataSource1" CssClass="NewGrid" ShowFooter="True" 
        AllowSorting="True" DataKeyNames="output_indicator_id">
        <AlternatingRowStyle CssClass="NewGridAlt" />
        <Columns>
            <asp:BoundField DataField="output_indicator_id"
                HeaderText="Output Indicator ID" SortExpression="output_indicator_id" ReadOnly="True"></asp:BoundField>
            <asp:BoundField DataField="name" HeaderText="Indicator" SortExpression="name"></asp:BoundField>
            <asp:BoundField DataField="baseline" HeaderText="Baseline" SortExpression="baseline"></asp:BoundField>
            <asp:BoundField DataField="target" HeaderText="Target" SortExpression="target"></asp:BoundField>
            <asp:BoundField DataField="data_source" HeaderText="Data Source" SortExpression="data_source"></asp:BoundField>
            <asp:BoundField DataField="method_of_collection" HeaderText="Method of Collection" SortExpression="method_of_collection"></asp:BoundField>
            <asp:BoundField DataField="collection_tools" HeaderText="Collection Tools" SortExpression="collection_tools"></asp:BoundField>
            <asp:BoundField DataField="assumptions_and_risks" HeaderText="Assumptions and Risks" SortExpression="assumptions_and_risks"></asp:BoundField>
            <asp:BoundField DataField="means_of_verification" HeaderText="Means of Verification" SortExpression="means_of_verification"></asp:BoundField>
        </Columns>
        <FooterStyle CssClass="NewGridFooter" />
    </asp:GridView>
    <% } %>

</asp:Content>
